package top.tangs.vitamin.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import top.tangs.vitamin.entity.Company;
import top.tangs.vitamin.util.DBManager;

public class CompanyDaoImpl {
	public List<Company> getUserList() {
		List<Company> list = new ArrayList<Company>();
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;

		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from company");
			while (rs.next()) {
				String companyName = rs.getString("companyName");
				String comPanywebsite = rs.getString("companyWebsite");
				String companyLogo = rs.getString("companyLogo");
				String companyHotline = rs.getString("companyHotline");
				String companyPhone = rs.getString("companyPhone");
				String companyEmail = rs.getString("companyEmail");
				String companyAddress = rs.getString("companyAddress");
				String companyErWeiMa = rs.getString("companyErweiMa");
				String companylntroduce1 = rs.getString("companylntroduce1");
				String companyintyoducelmg1 = rs.getString("companyintyoducelmg1");
				String companylntroduce2 = rs.getString("companylntroduce2");
//				  Company c = new Company(companyName,comPanywebsite,companyLogo,companyHotline,companyPhone,companyEmail,companyAddress,companyErWeiMa,companylntroduce1,companyintyoducelmg1,companylntroduce2);

//				   list.add(c);
			}
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		} finally {
			DBManager.closeAll(conn, st, rs);
		}
	}
}
